package com.tmpt.service.impl;

import com.tmpt.dao.intf.ITemplateDao;
import com.tmpt.dto.ConstantDto;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TemplateServiceUtils {

	@Resource private ITemplateDao templateBizDao;
	@Resource private ITemplateDao templateTemlDao;

	/**
	 * switch template dao by dataSource
	 * @param dataSource
	 * @return
	 */
	public ITemplateDao getTemplateDao(String dataSource){
		ITemplateDao templateDao;
		if(dataSource!=null && dataSource.equals(ConstantDto.bizDataSource)){
			templateDao = templateBizDao;
		}else{
			templateDao = templateTemlDao;
		}
		return templateDao;
	}


}
